#python-mysql   python-excel    mysql-excel

#将数据库中的数据读取到Excel文件中
import pandas as pd
import pymysql

#创建一个mysql的链接对象
conn = pymysql.Connect(
    host='127.0.0.1',
    port=3306,
    user='root',
    password='boboadmin',
    db='spider',
    charset='utf8'
)
table = pd.read_sql('select * from emp',conn)
table.to_excel('emp.xlsx')